<?php
class StatisticsSeasonPlayer extends AppModel {

	var $name = 'StatisticsSeasonPlayer';
	var $primaryKey = 'ID';

	var $virtualFields = array(
		'Inflicted_fAvgPasses' => '(CAST(Inflicted_iPasses AS REAL) / iMatchPlayed)',
		'Inflicted_fAvgCatches' => '(CAST(Inflicted_iCatches AS REAL) / iMatchPlayed)',
		'Inflicted_fAvgInterceptions' => '(CAST(Inflicted_iInterceptions AS REAL) / iMatchPlayed)',
    	'Inflicted_fAvgTouchdowns' => '(CAST(CAST(Inflicted_iTouchdowns AS REAL) AS REAL) / iMatchPlayed)',
	  	'Inflicted_fAvgCasualties' => '(CAST(Inflicted_iCasualties AS REAL) / iMatchPlayed)',
		'Inflicted_fAvgTackles' => '(CAST(Inflicted_iTackles AS REAL) / iMatchPlayed)',
		'Inflicted_fAvgKO' => '(CAST(Inflicted_iKO AS REAL) / iMatchPlayed)',
		'Inflicted_fAvgStuns' => '(CAST(Inflicted_iStuns AS REAL) / iMatchPlayed)',
		'Inflicted_fAvgInjuries' => '(CAST(Inflicted_iInjuries AS REAL) / iMatchPlayed)',
		'Inflicted_fAvgDead' => '(CAST(Inflicted_iDead AS REAL) / iMatchPlayed)',
		'Inflicted_fAvgMetersRunning' => '(CAST(Inflicted_iMetersRunning AS REAL) / iMatchPlayed)',
		'Inflicted_fAvgMetersPassing' => '(CAST(Inflicted_iMetersRunning AS REAL) / iMatchPlayed)',
		'Sustained_fAvgInterceptions' => '(CAST(Sustained_iInterceptions AS REAL) / iMatchPlayed)',
		'Sustained_fAvgCasualties' => '(CAST(Sustained_iCasualties AS REAL) / iMatchPlayed)',
		'Sustained_fAvgTackles' => '(CAST(Sustained_iTackles AS REAL) / iMatchPlayed)',
		'Sustained_fAvgKO' =>  '(CAST(Sustained_iKO AS REAL) / iMatchPlayed)',
		'Sustained_fAvgStuns' => '(CAST(Sustained_iStuns AS REAL) / iMatchPlayed)',
		'Sustained_fAvgInjuries' => '(CAST(Sustained_iInjuries AS REAL) / iMatchPlayed)',
	);

	var $belongsTo = array(
		'Player' => array(
			'className' => 'Player',
			'foreignKey' => 'idPlayer_Listing',
			/*'fields' => array('Player.ID, Player.strName, Player.iNumber, Player.idTeam_Listing'),*/
		),
		'Championship' => array(
			'className' => 'Championship',
			'foreignKey' => 'idRule_Listing',
			'fields' => array('Championship.ID, Championship.strName, Championship.iSeason'),
			)
	);

}
?>